<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>运营周报-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<link rel="stylesheet" href="__PUBLIC__/mobile/css/dropload.css">
</head>
<body>
<div class="header">
	<a class="menu_btn" href="javascript:;"><span class="sp1"></span><span class="sp2"></span><span class="sp3"></span></a>
	运营周报<if condition="((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id) or is_project($project['id'],52)) and ($project['status'] eq 1)">
	<if condition="($project_bg['project_stage'] neq NULL)">
	<a class="add_btn" href="__APP__/Mobile/Project/project_operate_add_zq/pid/{$project['id']}"></a>
	</if></if>
</div>
<include file="Include:commu_menu" />
<div class="content">
    <div class="operate_list">
        <if condition="$result eq NULL">
            <div class="no_data"></div>
        </if>
        <ul class="list">
			<foreach name="result" item="vo">
            <li class="clearboth">
				<a class="text_cont float_l" href="__APP__/Mobile/Project/project_operate_detail/id/{$vo['id']}/pid/{$vo['pid']}">
					<span class="week">{$vo['week']}</span>
					<div class="item-cont">
						<p class="time">{$vo['week_detail']}</p>
						<p class="user">负责人：{$vo['add_user']}<span class="mr10"></span><if condition="$vo['audit_user'] neq NULL">批复人：{$vo['audit_user']}</if></p>
					</div>
                </a>
                <div class="btn_cont float_r">
					<if condition="((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id) or (is_project($project['id'],52) and $vo['add_uid'] eq $login_id)) and ($project['status'] eq 1)">
						<if condition="$vo['status'] eq -1">
							<a href="javascript:;" class="btn icon_delete_btn delete" mid="{$vo['id']}" action="delete"></a><a href="__APP__/Mobile/Project/project_operate_edit_hb/mid/{$vo['id']}" class="btn icon_edit_btn"></a><a href="javascript:;" class="btn icon_sub_btn audit" mid="{$vo['id']}" action="audit"></a>
						<elseif condition="($vo['status'] eq 1) and ($vo['audit_user'] eq NULL)"/>
							<a href="javascript:;" class="btn icon_close_btn remove" mid="{$vo['id']}" action="remove"></a>
						</if>
                    </if>
                </div>
            </li>
			</foreach>
        </ul>
    </div>
</div>
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/dropload.min.js"></script>
<script>
	$(function(){
        menu();
    })
    $(function(){
        var $now2 = 1;
        var page = 10,
            $count = "{$count}",
            id = "{$project['id']}",
            max = Math.ceil(parseInt($count)/page);
        //提交按钮
        $('body').on("click",".audit",function(){
            var mid = $(this).attr("mid");
            $.ajax({
                cache:true,
                type:"POST",
                dataType:"json",
                url:"__APP__/Mobile/Project/project_operate_audit",
                data:{"id":mid,"action":"audit"},
                success:function(data){
                    success_pop(data['status'],data['msg']);
                }
            });
        });
        //放弃提交
         $('body').on("click",".remove",function(){
            var mid = $(this).attr("mid");
            $.ajax({
                cache:true,
                type:"POST",
                dataType:"json",
                url:"__APP__/Mobile/Project/project_operate_audit",
                data:{"id":mid,"action":"remove"},
                success:function(data){
                    success_pop(data['status'],data['msg']);
                }
            });
        });
        //删除
        $(".delete").ajaxModal({"body_text":"您确定要删除吗？","url":"__APP__/Mobile/Project/project_operate_audit","data":{"id":"mid","action":"action"}});

        $('.content').dropload({
            scrollArea : window,
            loadDownFn : function(me){
                if($now2<max){
                    var html = '',
                        $start_count = page*$now2;
                    $.ajax({
                        type: 'POST',
                        async:false,
				        dataType:"json",
                        data:{"start_size":$start_count,"start_page":page,"id":id},
                        url:"__APP__/Mobile/Project/project_operate_list_ajax",
                        dataType: 'json',
                        success: function(data){
                            if(data){
                                for(var i=0; i<data.length; i++){
                                    html += '<li class="clearboth">';
                                    html += '<a class="text_cont float_l" href="__APP__/Mobile/Project/project_operate_detail/id/'+data[i].id+'/pid/'+data[i].pid+'">';
                                    html += '<span class="week">'+data[i].week+'</span>';
                                    html += '<div class="item-cont">';
                                    html += '<p class="time">'+data[i].week_detail+'</p>';
                                    html += '<p class="user">负责人：'+data[i].add_user+'<span class="mr10"></span>';
                                    if(data[i].audit_user){
                                        html += '批复人：'+data[i].add_user+'';
                                    }
                                    html += '</p>';
                                    html += '</div>';
                                    html += '</a>';
                                    html += '<div class="btn_cont float_r">';
                                    if(data[i].status==-1){
                                        html += '<a class="btn icon_delete_btn delete" href="javascript:;" mid='+data[i].id+' action="delete"></a><a class="btn icon_edit_btn" href="__APP__/Mobile/Project/project_operate_edit_hb/mid/'+data[i].id+'"></a><a class="btn icon_sub_btn audit" href="javascript:;" mid='+data[i].id+' action="audit"></a>';
                                    }else if(data[i].status==1 && !data[i].audit_user){
                                        html += '<a class="btn icon_close_btn remove" href="javascript:;" mid='+data[i].id+' action="remove"></a>';
                                    }
                                    html += '</div>';
                                    html += '</li>';
                                }
                            }
                            $now2++;
                            $('.operate_list ul').append(html);
                            me.resetload();
                        },
                        error: function(xhr, type){
                            alert('Ajax error!');
                            // 即使加载出错，也得重置
                            me.resetload();
                        }
                    });
                }else{
                    me.lock();
                    me.noData();
                    me.resetload();
                    $('.dropload-down').hide();
                }
            }
        });
    })
</script>
</body>
</html>